package com.pianzhu.blockchainemr.controller;

import com.pianzhu.blockchainemr.pojo.Param.EnrollParam;
import com.pianzhu.blockchainemr.pojo.result.Result;
import com.pianzhu.blockchainemr.service.EnrollService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/enroll")
public class EnrollController {
    @Autowired
    private EnrollService enrollService;
    @PostMapping
    public Result enroll(@RequestBody EnrollParam enrollParam) {
        int result = enrollService.enroll(enrollParam);
        if (result == 0) {
            return Result.error("用户名重复");
        }
        return Result.success("OK");
    }
}
